package org.academic.texteditor.gui.style;

import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.geom.Point2D;

import javax.swing.BorderFactory;
import javax.swing.border.LineBorder;

class StyleFactoryImpl implements StyleFactory {

	StyleFactoryImpl() {

	}
	
	public Style getBaseStyle() {
		Style style = new Style("formulario.base");
		style.setFont(new Font("Arial Black", Font.BOLD, 30));
		style.setForeground(Color.BLUE);
		style.setBackground(Color.WHITE);
		style.setAlignment(Style.CENTER);
		return style;
	}

	public Style getButton() {
		Color gray1 = new Color(0xea,0xea,0xea);
		Color gray2 = new Color(0xc0,0xc0,0xc0);
		
		Point2D p1 = new Point2D.Double(0, 0);
		Point2D p2 = new Point2D.Double(100, 100);
		
		GradientPaint gradientPaint = new GradientPaint(p1, gray1, p2, gray2);
		
		Style style = new Style("botao.geral");
		style.setFont(new Font("Arial", Font.BOLD, 12));
		//style.setBorder(BorderFactory.createLineBorder(new Color(0x44, 0x44, 0x44), 1));
		style.setColor(gradientPaint);
		style.setBackground(new Color(0xe2,0xe2,0xe2));
		style.setForeground(new Color(0x44, 0x33, 0x44));
	    return style;
	}
	
	public Style getActionButton() {
		Color green1 = new Color(0x0, 0xcc, 0x0);
		Color green2 = new Color(0x0, 0x77, 0x0);
		
		Point2D p1 = new Point2D.Double(0, 0);
		Point2D p2 = new Point2D.Double(100, 100);
		
		GradientPaint gradientPaint = new GradientPaint(p1, green1, p2, green2);
		
		Style style = getButton();
		style.setFont(new Font("Arial", Font.BOLD, 16));
		style.setForeground(new Color(0xee, 0xee, 0xee));
		//style.setBorder(new LineBorder(new Color(0x44, 0x44, 0x44), 2));
		style.setColor(gradientPaint);
		return style;
	}
	
	public Style getHideButton() {
		Style style = new Style("button.hide");
		style.setFont(new Font("Arial", Font.BOLD, 13));
		style.setForeground(new Color(0x0, 0x0, 0xaa));
		style.setBorder(BorderFactory.createEmptyBorder());
		style.setBackground(new Color(0xef, 0xef, 0xef));
		return style;
	}

	public Style getCommonField() {
		Style style = new Style("comum.campo");
		style.setFont(new Font("Verdana", Font.PLAIN, 12));
		style.setBorder(BorderFactory.createLineBorder(new Color(0x44, 0x44, 0x44), 1));
		style.setForeground(new Color(0x44, 0x44, 0x44));
		style.setBackground(Color.WHITE);
		return style;
	}

	public Style getSelectedField() {
		Style style = getCommonField();
		style.setBorder(new LineBorder(new Color(0x44, 0x44, 0xff), 2));
		style.setBackground(new Color(0xff, 0xff, 0xee));
		return style;
	}

	public Style getCommonLabel() {
		Style style = new Style("comum.descricao");
		style.setFont(new Font("Verdana", Font.BOLD, 12));
		style.setForeground(new Color(0x44, 0x44, 0x44));
		return style;
	}

	public Style getFieldNumber() {
		Style style = getCommonField();
		style.setAlignment(Style.RIGHT);
	    return style;
	}

	public Style getTitleLabel() {
		Style style = getCommonLabel();
		style.setFont(new Font("Arial", Font.BOLD, 16));
		
		return style;
	}

	public Style getDescriptionField() {
		Style style = getCommonLabel();
		style.setFont(new Font("Arial", Font.ITALIC, 12));
		
		return style;
	}

}
